package cn.gzmli.dtt.common.workflow.entity;


import cn.gzmli.dtt.common.entity.User;

import javax.persistence.*;
import java.text.SimpleDateFormat;
import java.util.Date;

@Entity
public class TaskLog {

	@Id
	private Integer id;
	private Integer formId;
	@ManyToOne(fetch= FetchType.EAGER)
	@JoinColumn(name="forwarderID",referencedColumnName="id")
	private User forwarder;
	@ManyToOne(fetch= FetchType.EAGER)
	@JoinColumn(name="processerID",referencedColumnName="id")
	private User processer;
	private Integer status;
	private Integer forwordStatus;
	@ManyToOne(fetch= FetchType.EAGER)
	@JoinColumn(name="flowNodeID",referencedColumnName="id")
	private FlowNode flowNode;
	private Integer version;
	private String reply;
	private Date createTime;
	private Date procTime;
	@Transient
	private String createTimeFormat;
	@Transient
	private String procTimeFormat;
	
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getFormId() {
		return formId;
	}
	public void setFormId(Integer formId) {
		this.formId = formId;
	}
	public User getForwarder() {
		return forwarder;
	}
	public void setForwarder(User forwarder) {
		this.forwarder = forwarder;
	}
	public User getProcesser() {
		return processer;
	}
	public void setProcesser(User processer) {
		this.processer = processer;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public Integer getForwordStatus() {
		return forwordStatus;
	}
	public void setForwordStatus(Integer forwordStatus) {
		this.forwordStatus = forwordStatus;
	}
	public FlowNode getFlowNode() {
		return flowNode;
	}
	public void setFlowNode(FlowNode flowNode) {
		this.flowNode = flowNode;
	}
	public Integer getVersion() {
		return version;
	}
	public void setVersion(Integer version) {
		this.version = version;
	}
	public String getReply() {
		return reply;
	}
	public void setReply(String reply) {
		this.reply = reply;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public Date getProcTime() {
		return procTime;
	}
	public void setProcTime(Date procTime) {
		this.procTime = procTime;
	}
	
	public String getCreateTimeFormat() {
		if(getCreateTime()!=null){
			this.createTimeFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(getCreateTime());
		}
		return  this.createTimeFormat;
	}
	public void setCreateTimeFormat(String createTimeFormat) {
		this.createTimeFormat = createTimeFormat;
	}
	
	public String getProcTimeFormat() {
		if(getProcTime()!=null){
			this.procTimeFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(getProcTime());
		}
		return this.procTimeFormat;
	}
	public void setProcTimeFormat(String procTimeFormat) {
		this.procTimeFormat = procTimeFormat;
	}
	
}
